package com.zhou.basics.business.exception;

import com.zhou.basics.common.core.Result;
import com.zhou.basics.common.exception.ServiceException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @ProjectName: tsqingcheng
 * @ClassName: ExceptionController
 * @Time: 2020/2/27
 * @Author: zhou24
 * @Description:
 * @Experience:
 */
@RestController
@RequestMapping("/exception")
public class ExceptionController {
    @GetMapping("/npe")
    public void npe(){
        Result result = new Result();
        int code = result.getCode();
    }

    @GetMapping("/byzore")
    public void byzore(){
        int i = 1/0;
    }

    @GetMapping("/ioobe")
    public void ioobe(){
        List list = new ArrayList();
        list.get(2);
    }

    @GetMapping("/se")
    public void se(){
        throw new ServiceException();
    }
}
